{
语法百题 解题报告：
 http://git.oschina.net/et0662/sznoi-grammar/ 
}
var
	nFive, max:integer;
	a:array[0..16] of integer;
	count:integer;


procedure s(n:integer);
var
	i:integer;
begin
	if n=2*max then
	begin
		if(nFive=0)then
		begin
			inc(count);
		end;
	end
	else
	begin
		for i:=0 to 1 do
		begin
			if i=0 then
			begin
				if nFive<max then
				begin
					inc(nFive);
					a[n]:=i;
					s(n+1);
					dec(nFive);
				end;
			end
			else
			begin
				if nFive>0 then
				begin
					dec(nFive);
					a[n]:=i;
					s(n+1);
					inc(nFive);
				end;
			end;
		end;
	end;
end;

procedure dfs(n:integer);
var
	i:integer;
begin
	if n=2*max then
	begin
		if(nFive=0)then
		begin
			for i:= 0 to 2*max-1 do
				write(a[i],' ');
			writeln;
		end;
	end
	else
	begin
		for i:=0 to 1 do
		begin
			if i=0 then
			begin
				if nFive<max then
				begin
					inc(nFive);
					a[n]:=i;
					dfs(n+1);
					dec(nFive);
				end;
			end
			else
			begin
				if nFive>0 then
				begin
					dec(nFive);
					a[n]:=i;
					dfs(n+1);
					inc(nFive);
				end;
			end;
		end;
	end;
end;


begin
	readln(max);
	s(0);
	writeln(count);
	dfs(0);
end.
